<template>
  <!--发货地-->
  <div id="ShipAddressDetails">
    <g-details :detailData="inputData"
               :inputConfig="inputConfig"
               @pop="setData"
               ref="input"></g-details>
  </div>
</template>

<script>
import baseMixin from "@/mixins/BaseMixin";

export default {
  name: "ShipAddressDetails",
  mixins: [baseMixin],
  props: {
    inputData: {
      type: Object
    }
  },

  data () {
    return {
      inputConfig: [
          {
            type: "table",
            label: this.$t('in.suppliercode'),
            disabled: false,
            props: "suppliercode",
            tableConfig: [
              {
                label: this.$t('config.supplier'),
                prop: "storerkey",
                input: "input",
              },
              {
                label: this.$t('config.company'),
                prop: "company",
                input: "input",
              },
              {
                label: this.$t('config.city'),
                prop: "city",
                input: "input",
              },
              {
                label: this.$t('config.provice'),
                prop: "state",
                input: "input",
              },
              {
                label: this.$t('config.postcode'),
                prop: "zip",
                input: "input",
              },
            ],
            url: `/queryStorer/5/?/${this.$store.state.wms}`
          },
          {
            type: "input",
            label: this.$t('in.suppliername'),
            disabled: false,
            props: "suppliername"
          },
          {
            type: "input",
            label: this.$t('in.shipfromaddressline',{no:1}),
            disabled: false,
            props: "shipfromaddressline1"
          },
          {
            type: "input",
            label: this.$t('in.shipfromaddressline',{no:2}),
            disabled: false,
            props: "shipfromaddressline2"
          },
          {
            type: "input",
            label: this.$t('in.shipfromaddressline',{no:3}),
            disabled: false,
            props: "shipfromaddressline3"
          },
          {
            type: "input",
            label: this.$t('in.shipfromaddressline',{no:4}),
            disabled: false,
            props: "shipfromaddressline4"
          },
          {
            type: "input",
            label: this.$t('in.shipfromaddressline',{no:5}),
            disabled: false,
            props: "shipfromaddressline5"
          },
          {
            type: "input",
            label: this.$t('in.shipfromaddressline',{no:6}),
            disabled: false,
            props: "shipfromaddressline6"
          },
          {
            type: "input",
            label: this.$t('config.city'),
            disabled: false,
            props: "shipfromcity"
          },
          {
            type: "input",
            label: this.$t('bill.province'),
            disabled: false,
            props: "shipfromstate"
          },
          {
            type: "input",
            label: this.$t('config.postcode'),
            disabled: false,
            props: "shipfromzip"
          },
          {
            type: "input",
            label: this.$t('config.contact'),
            disabled: false,
            props: "shipfromcontact"
          },
          {
            type: "input",
            label: this.$t('app.email'),
            disabled: false,
            props: "shipfromemail"
          },
          {
            type: "input",
            label: this.$t('config.phone'),
            disabled: false,
            props: "shipfromphone"
          }
      ],
    }
  },
  methods: {
    setData (data, close, listId) {

      if (data.storerkey) {
        this.$set(this.inputData, "suppliercode", data.storerkey)
      }
      if (data.company) {
        this.$set(this.inputData, "suppliername", data.company)
      }


      if (data.address1) {
        this.$set(this.inputData, "shipfromaddressline1", data.address1)
      }
      if (data.address2) {
        this.$set(this.inputData, "shipfromaddressline2", data.address2)
      }
      if (data.address3) {
        this.$set(this.inputData, "shipfromaddressline3", data.address3)
      }
      if (data.address4) {
        this.$set(this.inputData, "shipfromaddressline4", data.address4)
      }
      if (data.address5) {
        this.$set(this.inputData, "shipfromaddressline5", data.address5)
      }
      if (data.address6) {
        this.$set(this.inputData, "shipfromaddressline6", data.address6)
      }
      if (data.city) {
        this.$set(this.inputData, "shipfromcity", data.city)
      }
      if (data.state) {
        this.$set(this.inputData, "shipfromstate", data.state)
      }
      if (data.zip) {
        this.$set(this.inputData, "shipfromzip", data.zip)
      }
      if (data.contact1) {
        this.$set(this.inputData, "shipfromcontact", data.contact1)
      }
      if (data.email1) {
        this.$set(this.inputData, "shipfromemail", data.email1)
      }
      if (data.phone1) {
        this.$set(this.inputData, "shipfromphone", data.phone1)
      }
      close(false);
    }
  },
  mounted () {
  },
}
</script>

<style scoped>
</style>

